﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using YunSpace.Application.SiteMgr;
using YunSpace.Core;

namespace YunSpace.Web.Areas.MyTask.Controllers
{
    public class CustomerMangerController : ControllerBase
    {
        SiteClientsApp siteApp = new SiteClientsApp();
        [HttpGet]
        public ActionResult GetGridDataJson(Pagination pagination,string queryJson)
        {            
            var data = new
            {
                //rows = siteApp.GetListForLeader(pagination, queryJson),
                //total = pagination.total,
                //page = pagination.page,
                //records = pagination.records
            };
            return Content(data.ToJson());
        }

        [HttpGet]
        public ActionResult GetItemListJson()
        {
            var data = new
            {
                citys = siteApp.GetItemList("city"),
                khdjs = siteApp.GetItemList("khdj"),
                khlxs = siteApp.GetItemList("khlx"),
                sshys = siteApp.GetItemList("sshy"),
                ssbms = siteApp.GetItemList("bmmc"),
                gszws = siteApp.GetItemList("gszw"),
                ActivityType = siteApp.GetItemList("ActivityType"),
                SiteType = siteApp.GetItemList("SiteType"),
            };
            return Content(data.ToJson());
        }

        [HttpGet]
        public ActionResult GetUsersJson() {
            var data = siteApp.GetUsersJson();
            return Content(data.ToJson());
        }       

        [HttpGet]
        public ActionResult GetIndustryRecord(Pagination pagination, string queryJson)
        {           
            var data = new
            {
                rows = siteApp.GetIndustryRecordFor(pagination, queryJson),
                total = pagination.total,
                page = pagination.page,
                records = pagination.records
            };
            return Content(data.ToJson());
        }
    }
}
